package de.gameduell.framework.locale {
	import flash.display.Sprite;
	import flash.text.TextField;
	import flash.text.TextFormat;
	
	import de.gameduell.framework.gui.util.AutoSize;
	import de.gameduell.framework.locale.Localizable;	

	/**
	 * @author cbra
	 */
	public class LocalizableTextField implements Localizable {
		
		private var textField:TextField;
		private var _id:String;
		private var _sprite:Sprite;
		private var _localizables:Array;
	
		public function LocalizableTextField(aTextField:TextField, aId:String) {			
			textField = aTextField;
			_id = aId;
			_sprite = new Sprite();
			_localizables = new Array();
		}
		
		public function set autoSize(auto:String):void{
			textField.autoSize = auto;
			if(auto != AutoSize.NONE){
				var format:TextFormat = new TextFormat();
				format.align = auto;
				textField.setTextFormat(format);
			}
		}
		
		public function setText(aText:String, isHtml:Boolean, aAutoSize:String):void {
			autoSize = aAutoSize;
			if(isHtml){
				textField.htmlText = aText;
			}else{
				textField.text = aText;
			}
		}
		
		public function addLocalizable(aLocalizable:Localizable):void {
		}
		
		public function get id():String {
			return _id;
		}
		
		public function get sprite():Sprite {
			return new Sprite();
		}
		
		public function get localizableChildren():Array {
			return _localizables;
		}
		
		public function set id(aId:String):void {
			_id = aId;
		}
	}
}



